import Vue from 'vue'
import Router from 'vue-router'
Vue.use(Router)

const originalPush = Router.prototype.push
Router.prototype.push = function push(location) {
  return originalPush.call(this, location).catch(err => err)
}
export default new Router({
  routes: [
    {
      path: '/', name: 'Index', component: () => import('../components/Index.vue'),
    },
    {
      path: '/login', name: 'Login', component: () => import('../components/login/Login')
    },
    {path: '/workflow', name: 'workflow', component: () => import('../components/Index.vue'),
      children: [
        {path: 'process_deploy',name: 'process_deploy',  component: () => import('../components/views/workflow/process-deploy/ProcessDeploy')},
        {path: 'process_group',name: 'process_group',  component: () => import('../components/views/workflow/process-group/ProcessGroup')},
        {path: 'process_approval',name: 'process_approval',  component: () => import('../components/views/workflow/process-approval/ProcessApproval')},
        {path: 'process_handle_his',name: 'process_handle_his',  component: () => import('../components/views/workflow/process-approval/ProcessApprovalHis')},
        {path: 'leave_handle',name: 'leave_handle',  component: () => import('../components/views/workform/leave-apply/LeaveAppalyHandle')},

      ]
    },
    {path: '/sys', name: 'sys', component: () => import('../components/Index.vue'),
      children: [
        {path: 'home_page',name: 'home_page',  component: () => import('../components/home/HomePage')},
        {path: 'company',name: 'company',  component: () => import('../components/views/sys/sys-company/SysCompany')},
        {path: 'user',name: 'user',  component: () => import('../components/views/sys/sys-user/SysUser')},

        {path: 'login_log',name: 'login_log', component: () => import('../components/views/sys/sys_log/SysLoginLog')},

        {path: 'role',name: 'role', component: () => import('../components/views/sys/sys-role/SysRole')},

        {path: 'menu',name: 'menu',  component: () => import('../components/views/sys/sys-menu/SysMenu')},
        {path: 'dept',name: 'dept',  component: () => import('../components/views/sys/sys_dept/SysDept')},
        {path: 'location',name: 'location',  component: () => import('../components/views/sys/sys-location/SysLocation3')},
      ]
    },
    {path: '/dict', name: 'dict', component: () => import('../components/home/HomePage'),
      children: [
        {path: 'data',name: 'data', component: () => import('../components/views/sys/sys-user/SysUser')},
      ]
    },

    {path: '/joy', name: 'joy', component: () => import('../components/Index.vue'),
      children: [
        {path: 'headlines',name: 'headlines', component: () => import('../components/views/joy/headlines/JoyHeadlines')},
        {path: 'wx_selection',name: 'wx_selection', component: () => import('../components/views/joy/headlines/WeChatSelection')},
        {path: 'vegetable',name: 'vegetable', component: () => import('../components/views/joy/vegetable/VegetableMenu')},
      ]
    },
    {path: '/food', name: 'food', component: () => import('../components/Index.vue'),
      children: [
        {path: 'list',name: 'list',  component: () => import('../components/views/food/FoodList')},
      ]
    },

    {path: '/tool', name: 'tool', component: () => import('../components/Index.vue'),
      children: [
        {path: 'code',name: 'code', component: () => import('../components/views/tool/tool-code/ToolCode')},
        {path: 'interface',name: 'interface', component: () => import('../components/views/tool/tool-interface/ToolInterface')},
        {path: 'sql',name: 'interface', component: () => import('../components/views/tool/tool-sql/ToolSql')},

      ]
    },
    {path: '/goods', name: 'goods', component: () => import('../components/Index.vue'),
      children: [
        {path: 'category',name: 'category', component: () => import('../components/views/goods/goods-category/GoodsCategory')},
        {path: 'product',name: 'product', component: () => import('../components/views/goods/goods-product/GoodsProduct')},
      ]
    },

    {path: '/trader', name: 'trader', component: () => import('../components/Index.vue'),
      children: [
        {path: 'customer',name: 'customer', component: () => import('../components/views/trader/trader-customer/TraderCustomer')},
        {path: 'supplier',name: 'supplier', component: () => import('../components/views/trader/trader-supplier/TraderSupplier')},
      ]
    },



    {path: '/purchase', name: 'purchase', component: () => import('../components/Index.vue'),
      children: [
        {path: 'order',name: 'order', component: () => import('../components/views/purchase/purchase-order/PurchaseOrder')},
        {path: 'cart',name: 'cart', component: () => import('../components/views/purchase/purchase-cart/PurchaseCart')},
        {path: 'history',name: 'history', component: () => import('../components/views/purchase/purchase-history/PurchaseHistory')},
      ]
    },


    {path: '/sales', name: 'sales', component: () => import('../components/Index.vue'),
      children: [
        {path: 'order',name: 'order', component: () => import('../components/views/sales/sales-order/SalesOrder')},
        {path: 'history',name: 'history', component: () => import('../components/views/sales/sales-history/SalesHistory')},
      ]
    },
    {path: '/msg', name: 'msg', component: () => import('../components/Index.vue'),
      children: [
        {path: 'my_msg',name: 'my_msg', component: () => import('../components/views/msg/MyMsg')},
      ]
    },

    {path: '/approval', name: 'approval', component: () => import('../components/Index.vue'),
      children: [
        {path: 'leave_approval',name: 'leave_approval',  component: () => import('../components/views/approval/leave_approval/LeaveApproval')},
      ]
    },


    {path: '*', redirect:'/'},
  ]
})
